package com.ruoyi.quan.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quan.mapper.QContentMapper;
import com.ruoyi.quan.domain.QContent;
import com.ruoyi.quan.service.IQContentService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;

/**
 * 内容生产Service业务层处理
 * 
 * @author ruoyi
 */
@Service
public class QContentServiceImpl implements IQContentService 
{
    @Autowired
    private QContentMapper qContentMapper;

    /**
     * 查询内容生产
     * 
     * @param componentId 内容生产主键
     * @return 内容生产
     */
    @Override
    public QContent selectQContentByComponentId(Long componentId)
    {
        return qContentMapper.selectQContentByComponentId(componentId);
    }

    /**
     * 查询内容生产列表
     * 
     * @param qContent 内容生产
     * @return 内容生产
     */
    @Override
    public List<QContent> selectQContentList(QContent qContent)
    {
        return qContentMapper.selectQContentList(qContent);
    }

    /**
     * 新增内容生产
     * 
     * @param qContent 内容生产
     * @return 结果
     */
    @Override
    public int insertQContent(QContent qContent)
    {
        qContent.setCreateTime(DateUtils.getNowDate());
        qContent.setUpdateTime(DateUtils.getNowDate());
        qContent.setCreateBy(SecurityUtils.getUsername());
        qContent.setUpdateBy(SecurityUtils.getUsername());
        
        return qContentMapper.insertQContent(qContent);
    }

    /**
     * 修改内容生产
     * 
     * @param qContent 内容生产
     * @return 结果
     */
    @Override
    public int updateQContent(QContent qContent)
    {
        qContent.setUpdateTime(DateUtils.getNowDate());
        qContent.setUpdateBy(SecurityUtils.getUsername());
        return qContentMapper.updateQContent(qContent);
    }

    /**
     * 批量删除内容生产
     * 
     * @param componentIds 需要删除的内容生产主键
     * @return 结果
     */
    @Override
    public int deleteQContentByComponentIds(Long[] componentIds)
    {
        return qContentMapper.deleteQContentByComponentIds(componentIds);
    }

    /**
     * 删除内容生产信息
     * 
     * @param componentId 内容生产主键
     * @return 结果
     */
    @Override
    public int deleteQContentByComponentId(Long componentId)
    {
        return qContentMapper.deleteQContentByComponentId(componentId);
    }
} 